//4
#include<bits/stdc++.h>
using namespace std;
int n,sum;
int a[200005],ans[200005];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	a[0]=-1;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	while(1){
		int cnt=0,old=-1;
		for(int i=1;i<=n;i++){
			if(a[i]==-1) continue;
			if(a[i]!=old){
				ans[++cnt]=i;
				old=a[i];
				a[i]=-1;
			}
		}
		if(cnt==0) break;
		for(int i=1;i<=cnt;i++) printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
} 
